package bufete;

import callProcs.ProcsInsertar;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Javier
 */
public class Ver_Seguimiento_caso extends javax.swing.JFrame {

    String idCaso, usuario;
    public Ver_Seguimiento_caso() {
        initComponents();
        l_usuario.setText(usuario);
        
        
    }
    
    public void get_idcaso(String id)
    {
        idCaso = id;
        
    }        
    
    public void llena_tabla()
    {
        ProcsInsertar ver = new ProcsInsertar();
        java.sql.ResultSet rs = null;
        Vector<String> tableHeaders = new Vector<String>();
        Vector tableData = new Vector();
        tableHeaders.add("Id_caso");
        tableHeaders.add("Fecha_creado"); 
        tableHeaders.add("Comentario");
        try 
        {
            rs = ver.ver_seguimiento(idCaso);
            while (rs.next())
            {
               Vector<Object> oneRow = new Vector<Object>();
               oneRow.add(rs.getInt("Caso_idcaso"));
               oneRow.add(rs.getString("Fecha_creado"));
               oneRow.add(rs.getString("Comentario"));
               tableData.add(oneRow);
            }
            t_seg.setModel(new DefaultTableModel(tableData, tableHeaders));
            t_seg.getTableHeader().getColumnModel().getColumn(0).setPreferredWidth(0);
            t_seg.getTableHeader().getColumnModel().getColumn(0).setPreferredWidth(0);
            t_seg.getTableHeader().getColumnModel().getColumn(0).setPreferredWidth(0);
         } catch (SQLException ex) {}
     }
    
    public void set_user(String user)
    {
        usuario = user;
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        t_seg = new javax.swing.JTable();
        l_usuario = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();

        setName("Form"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        t_seg.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        t_seg.setName("t_seg"); // NOI18N
        jScrollPane1.setViewportView(t_seg);

        l_usuario.setName("l_usuario"); // NOI18N

        jLabel1.setName("jLabel1"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bufete.BufeteApp.class).getContext().getResourceMap(Ver_Seguimiento_caso.class);
        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(l_usuario))
                .addContainerGap(30, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(213, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1))
                .addGap(218, 218, 218))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(l_usuario)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(31, 31, 31)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Ver_Seguimiento_caso().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel l_usuario;
    private javax.swing.JTable t_seg;
    // End of variables declaration//GEN-END:variables

   
    
}
